package com.lagado.rrex;

public class LazyQuantifier extends Quantifier {

    public LazyQuantifier(RRex quantifiedExpression) {
        super(quantifiedExpression);
    }

    @Override
    public RRex ZeroOrMore() {
        return super.ZeroOrMore().add("?");
    }

    @Override
    public RRex OneOrMore() {
        return super.OneOrMore().add("?");
    }

    @Override
    public RRex Exactly(int timesToRepeat) {
        return super.Exactly(timesToRepeat).add("?");
    }

    public RRex AtLeast(int timesToRepeat) {
        return super.AtLeast(timesToRepeat).add("?");
    }

    public RRex Optional() {
        return super.Optional().add("?");
    }

    public RRex InRange(int minimum, int maximum) {
        return super.InRange(minimum, maximum).add("?");
    }

    public RRex AtMost(int timesToRepeat) {
        throw new UnsupportedOperationException(
                "You cannot perform lazy evaluation of the atMost {,n} quantifier.");
    }
}
